<?php
namespace Home\Controller;
use Think\Controller;
class ShopSingleController extends Controller {
    public function index(){
        $this->show();
    }
    public function add(){
        $data['name']=I('post.name');
       // $data['name']=I('post.price');
       // var_dump($_POST['price']);
        $User = M("daohang"); // 实例化User对象

        $ab= $User->add($data);
        if($ab){
           echo '添加成功';
        }else{
            echo '添加失败';
        }
    }
    public function search(){
       $name=I('post.name');
       // var_dump($name);
        // var_dump($_POST['price']);
        $User = M("daohang"); // 实例化User对象

        $ab= $User->where("name like '%".$name."%'")->select();
        $this->assign('abc',$ab);
        $this->display('index');
    }
}